package com.tang.commodity.controller;

import com.tang.commodity.entity.OrderDetail;
import com.tang.commodity.service.OrderDetailService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*
 *文件名: OrderDetailController
 *创建者: 醉意丶千层梦
 *创建时间:2021/12/13 13:17
 *描述: 这是一个示例
 */
@RestController
public class OrderDetailController {
    @Autowired
    private OrderDetailService orderDetailService;
    private static Logger logger = LogManager.getLogger(ClientController.class);

    @ResponseBody
    @RequestMapping(value = "/orderDetail/searchByNo",method = RequestMethod.POST)
    public List<OrderDetail> searchOrderDetail(String no){
        if (no==null || no.isEmpty())
            return null;
        return orderDetailService.searchOrderDetailByNo(no);
    }

    @ResponseBody
    @RequestMapping(value = "/orderDetail/searchByOrderNo",method = RequestMethod.POST)
    public List<OrderDetail> searchOrderDetailByOrderNo(String OrderNo){
        if (OrderNo==null)
            return null;
        logger.info("search searchOrderDetailByOrderNo for OrderNo : " +OrderNo);
        return orderDetailService.searchOrderDetailByOrderNo(OrderNo);
    }
}
